void Sweap(SortTypeData* a, SortTypeData* b)
{
	SortTypeData tmp = *a;
	*a = *b;
	*b = tmp;
}
void BubbleSort(SortTypeData* a, int n)
{
	for (int i = 0; i < n; i++)
	{
		bool exchange = false;
		for (int j = 1; j < n - i; j++)
		{
			if (a[j-1] > a[j])
			{
				Sweap(&a[j-1], &a[j]);
				exchange = true;
			}
		}
		if (exchange == false)
		{
			break;
		}
	}
}

void SelectSort(SortTypeData* a, int n)
{
	int begin = 0, end = n - 1;
	
	while (begin < end)
	{
		int maxi = begin, mini = begin;
		for (int i = begin; i <= end; i++)
		{
			if (a[i] > a[maxi])
			{
				maxi = i;
			}
			if (a[i] < a[mini])
			{
				mini = i;
			}
		}
		Sweap(&a[begin], &a[mini]);
		if (maxi == begin)
		{
			maxi = mini;
		}
		Sweap(&a[end], &a[maxi]);
		begin++;
		end--;
	}
}
